# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[self._target_zone = target_zone
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb756e54c>}
nname: 188
n 188(None)[send('cursor', action='send_mouse', sender=player, x=x, y=y)
return None
]:
	i: 61(), 163()
	o: 

nname: 163
n 163(None)[x = int(x)
y = int(y)
]:
	i: 0(f)
	o: 188()

nname: 61
n 61(None)[xmin, xmax, ymin, ymax = target_zone
a = (xmax - xmin) / DISPLAY_WIDTH
b = xmin
x = int(a * x + b)
a = (ymax - ymin) / DISPLAY_HEIGHT
b = ymin
y = int(a * y + b)
]:
	i: 0(t)
	o: 188()

nname: 0
n 0(target_zone is not None)[x = float(x) / 100.0 * DISPLAY_WIDTH
y = float(y) / 100.0 * DISPLAY_HEIGHT
target_zone = self._target_zone
]:
	i: 
	o: 61(t), 163(f)

nname: 0
n 0(None)[x = float(x) / 100.0 * DISPLAY_WIDTH
y = float(y) / 100.0 * DISPLAY_HEIGHT
target_zone = self._target_zone
if target_zone is not None:
	xmin, xmax, ymin, ymax = target_zone
	a = (xmax - xmin) / DISPLAY_WIDTH
	b = xmin
	x = int(a * x + b)
	a = (ymax - ymin) / DISPLAY_HEIGHT
	b = ymin
	y = int(a * y + b)
else:
	x = int(x)
	y = int(y)
send('cursor', action='send_mouse', sender=player, x=x, y=y)
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb757310c>}
nname: 6
n 6(None)[__doc__ = ' A cursor that can move on the screen.\n\n        To use it:\n        - in the menu constructor:\n            self._cursor = Cursor()\n            self._getitems_keywords[\'cursor\'] = lambda: None\n\n        - in the menu\'s event_handler:\n            def event_mouse(self, event):\n                arg = event.arg\n                self.player._cursor.set_absolute(arg["x"], arg["y"], self.player)\n\n        - in the menu\'s skin:\n            <cursor name="cursor" height="2%" width="2%">\n                <image layer="10" hcenter="0%" vcenter="0%" file="/path/cursor.png"\n                       preserve_aspect="true" keep_real_size="true" />\n            </cursor>\n    '
__slots__ = '_target_zone'
def __init__(self, target_zone=None):
	self._target_zone = target_zone

def set_absolute(self, x, y, player):
	x = float(x) / 100.0 * DISPLAY_WIDTH
	y = float(y) / 100.0 * DISPLAY_HEIGHT
	target_zone = self._target_zone
	if target_zone is not None:
		xmin, xmax, ymin, ymax = target_zone
		a = (xmax - xmin) / DISPLAY_WIDTH
		b = xmin
		x = int(a * x + b)
		a = (ymax - ymin) / DISPLAY_HEIGHT
		b = ymin
		y = int(a * y + b)
	else:
		x = int(x)
		y = int(y)
	send('cursor', action='send_mouse', sender=player, x=x, y=y)
	return None

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7566fcc>}
nname: 0
n 0(None)[from peewee.messages import send
from pygui import config
DISPLAY_WIDTH = config.display_width
DISPLAY_HEIGHT = config.display_height
class Cursor(object):
	__doc__ = ' A cursor that can move on the screen.\n\n        To use it:\n        - in the menu constructor:\n            self._cursor = Cursor()\n            self._getitems_keywords[\'cursor\'] = lambda: None\n\n        - in the menu\'s event_handler:\n            def event_mouse(self, event):\n                arg = event.arg\n                self.player._cursor.set_absolute(arg["x"], arg["y"], self.player)\n\n        - in the menu\'s skin:\n            <cursor name="cursor" height="2%" width="2%">\n                <image layer="10" hcenter="0%" vcenter="0%" file="/path/cursor.png"\n                       preserve_aspect="true" keep_real_size="true" />\n            </cursor>\n    '
	__slots__ = '_target_zone'
	def __init__(self, target_zone=None):
		self._target_zone = target_zone

	def set_absolute(self, x, y, player):
		x = float(x) / 100.0 * DISPLAY_WIDTH
		y = float(y) / 100.0 * DISPLAY_HEIGHT
		target_zone = self._target_zone
		if target_zone is not None:
			xmin, xmax, ymin, ymax = target_zone
			a = (xmax - xmin) / DISPLAY_WIDTH
			b = xmin
			x = int(a * x + b)
			a = (ymax - ymin) / DISPLAY_HEIGHT
			b = ymin
			y = int(a * y + b)
		else:
			x = int(x)
			y = int(y)
		send('cursor', action='send_mouse', sender=player, x=x, y=y)
		return None



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb75669ec>}
from peewee.messages import send
from pygui import config
DISPLAY_WIDTH = config.display_width
DISPLAY_HEIGHT = config.display_height
class Cursor(object):
	__doc__ = ' A cursor that can move on the screen.\n\n        To use it:\n        - in the menu constructor:\n            self._cursor = Cursor()\n            self._getitems_keywords[\'cursor\'] = lambda: None\n\n        - in the menu\'s event_handler:\n            def event_mouse(self, event):\n                arg = event.arg\n                self.player._cursor.set_absolute(arg["x"], arg["y"], self.player)\n\n        - in the menu\'s skin:\n            <cursor name="cursor" height="2%" width="2%">\n                <image layer="10" hcenter="0%" vcenter="0%" file="/path/cursor.png"\n                       preserve_aspect="true" keep_real_size="true" />\n            </cursor>\n    '
	__slots__ = '_target_zone'
	def __init__(self, target_zone=None):
		self._target_zone = target_zone

	def set_absolute(self, x, y, player):
		x = float(x) / 100.0 * DISPLAY_WIDTH
		y = float(y) / 100.0 * DISPLAY_HEIGHT
		target_zone = self._target_zone
		if target_zone is not None:
			xmin, xmax, ymin, ymax = target_zone
			a = (xmax - xmin) / DISPLAY_WIDTH
			b = xmin
			x = int(a * x + b)
			a = (ymax - ymin) / DISPLAY_HEIGHT
			b = ymin
			y = int(a * y + b)
		else:
			x = int(x)
			y = int(y)
		send('cursor', action='send_mouse', sender=player, x=x, y=y)
		return None



